package cn.smile.feign.hystrix.impl;

import cn.smile.feign.Feign;
import cn.smile.pojo.User;
import org.springframework.stereotype.Component;

import java.sql.Timestamp;

/**
 * Feign使用熔断器
 *
 * @Author: MaoSuyu
 * @User：John
 * @Date: 2019/5/29
 * @Time: 14:14
 * @Description: No Description
 */
@Component
public class FeignHystrixImpl implements Feign {


    @Override
    public User getUser() {
        System.out.println("线程："+Thread.currentThread().getName());
        return new User("服务挂了",new Timestamp(System.currentTimeMillis()));
    }

    @Override
    public User getUser(User user) {
        return user=new User("服务挂掉了",new Timestamp(System.currentTimeMillis()));
    }

    @Override
    public String test() {
        return "服务挂了";
    }

    @Override
    public String hystrix() {
        return "服务挂了";
    }

    @Override
    public String getServer() {
        System.out.println("线程："+Thread.currentThread().getName());
        return "服务挂了";
    }


}
